xl: Remove some duplicated boilerplate. (Improves logging slightly.)
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Apr 2010 16:44:47 +0000 (17:44 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Apr 2010 16:44:47 +0000 (17:44 +0100)
commite5f63f2ca9c3d437cfc717f6ccbdecf7804e6b3e
tree44bdda2fcbc680760145b6fb82f00b2fad6dec35
parent0ac8d8f1693527efd5f3a20ba8662f80434a1597
xl: Remove some duplicated boilerplate. (Improves logging slightly.)

We remove six lines of boilerplate from the top of each function, and
instead have a single struct libxl_ctx which is initialised once at
the top of main.

Likewise we wrap domain_qualifier_to_domid in a new function
find_domain, which does the error handling, and stores the domid and
the specified name (if applicable).

This reduces the size of xl.c by 7% (!)

As a beneficial side effect, the earlier call to libxl_ctx_set_log in
main makes some lost messages appear.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_utils.c
tools/libxl/libxl_utils.h
tools/libxl/xl.c